Skip to content

feat(tests): overhaul staging test infrastructure and update fixtures#1392

Open
tychtjan wants to merge 4 commits intomasterfrom
tests_rewrite_staging
Open

feat(tests): overhaul staging test infrastructure and update fixtures#1392
tychtjan wants to merge 4 commits intomasterfrom
tests_rewrite_staging

Conversation

@tychtjan
Copy link
Contributor

@tychtjan tychtjan commented Mar 5, 2026

Summary

Added staging test support (PYTHON_DEX), which required rewrites in the test
infrastructure (dynamic PostgreSQL URL replacement instead of duplicating fixtures)
and a new CI workflow for pre-merge staging tests.

Changes by commit

1. chore: regenerate API client from updated OpenAPI spec

  • Updated OpenAPI-generated API client with new models and endpoints
  • Reviewer: auto-generated, safe to skip

2. feat(ci): add staging test infrastructure and harden test setup

  • Add staging-tests.yaml workflow (triggered by label, /test-staging comment, or manual dispatch)
  • Overhaul conftest.py for dynamic data source URL replacement (staging vs local)
  • Add clean_staging.py and upload_demo_layout.py helper scripts
  • Unify token passing: all staging make targets use TOKEN= argument
  • Fix LLM provider patch to use InAttributes after spec removed PatchAttributes
  • Add alternativeDataSourceId to data source fixture
  • Document staging test workflow in CONTRIBUTING.md

3. chore: regenerate test cassettes

  • Regenerated all cassettes against staging environment
  • Reviewer: regenerated fixtures, safe to skim

Test plan

  • Passes local tests
  • Passes staging environment tests

JIRA: DX-431
risk: low

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.53%. Comparing base (46c0f4b) to head (038dfb9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1392      +/-   ##
==========================================
- Coverage   77.53%   77.53%   -0.01%     
==========================================
  Files         225      225              
  Lines       14614    14613       -1     
==========================================
- Hits        11331    11330       -1     
  Misses       3283     3283              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +60 to +61
- name: Clean staging environment
run: make clean-staging TOKEN=${{ secrets.PYTHON_SDK_STG_API_KEY }}
Copy link
Contributor

@hkad98 hkad98 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Clean staging environment
run: make clean-staging TOKEN=${{ secrets.PYTHON_SDK_STG_API_KEY }}
- name: Clean staging environment
run: make clean-staging
env:
TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }}

Either use secrets in env or with.

@tychtjan tychtjan force-pushed the tests_rewrite_staging branch from 44844f3 to 54e15b1 Compare March 12, 2026 07:59
@tychtjan
Copy link
Contributor Author

tychtjan commented Mar 12, 2026

I analyzed why there were some of the bigger deletes in the fixtures

 # OLD: cleanup + verification assertion
  finally:
      sdk.catalog_organization.delete_jwk("demoJwk")
      assert len(sdk.catalog_organization.list_jwks()) == 0  # <-- this GET is now gone

The new pattern uses safe_delete() which only calls the delete, no verification list:

  # NEW: cleanup only, no verification
  finally:
      safe_delete(sdk.catalog_organization.delete_jwk, "demoJwk")

This removes the final GET ...?page=0&size=500 call that verified the entity was gone.
That's why every cassette has a trailing interaction block removed — it was the VCR recording of
that verification GET. This is entirely expected and correct. The verification was fragile on staging (where other entities may exist, making len(...) == 0 fail), and the safe_delete + snapshot/restore approach is more robust.

@tychtjan tychtjan force-pushed the tests_rewrite_staging branch from 7a6168a to b8b6a13 Compare March 12, 2026 09:16
- Add staging test workflow and configuration
- Overhaul test conftest and catalog test files for staging support
- Add docker-compose env vars, clean_staging and upload_demo_layout scripts
- Fix LLM provider patch to use InAttributes after spec change
- Add alternativeDataSourceId to data source fixture
- Fix docs CI (toml dep, stale artifacts, baseURL, Hugo caching)
- Add docs API reference pre-rendering and tests
- Add AIDA onboarding artifacts
@tychtjan tychtjan force-pushed the tests_rewrite_staging branch from b8b6a13 to d2e0811 Compare March 12, 2026 09:19
Comment on lines +57 to +58
- name: Install dependencies
run: uv sync --all-groups --locked
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too broad. Consider checking out .github/workflows/rw-python-tests.yaml and unit-tests.

Copy link
Contributor Author

@tychtjan tychtjan Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to run: uv sync --group test --locked

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants